<script src="../media/system/js/mootools-core.js" type="text/javascript"></script>
<script src="../media/system/js/core.js" type="text/javascript"></script>
<form action="index.php?top=page&option=com_frtown" method="post" name="adminForm" id="adminForm">
    <!-- LEFT -->
    <?php echo $this->loadTemplate('search','default') ?>
    <!-- END LEFT -->

    <!-- CONTENT -->
    <div id="jm-content">
        <div class="cc title">
            <div class="id"><?php echo $this->row->TOWN_CODE; ?></div>
            <div class="cc-title">
                <p class="top"><?php echo $this->row->TOWN_KANA; ?></p>
                <p class="bot"><?php echo $this->row->TOWN_NAME; ?></p>
            </div>
        </div>
        <div class="clearfix"></div>
        <!-- SUB MENU -->
        <div class="menu-cc">
            <ul id="nav">
                <?php 
                foreach(bgData::getMenuDetailTown() as $key=>$item){
                    $acctive = 'normal';
                    if(JRequest::getVar('task') == $key){
                        $acctive = 'current';
                    }
                    ?>
                    <li class="<?php echo $acctive; ?>"><a href="index.php?top=page&option=com_frtown&task=<?php echo $key; ?>&id=<?php echo $this->row->TOWN_CODE; ?>"><?php echo $item; ?></a></li>
                    <?php } ?>
                </ul>
            </div>
            <!-- END SUB MENU -->
            <div id="">
                <h3 class="h_title"><label class="jm_name">センター・クラブ</label><!--<span style="float: right;"><button href="" id="icon">アイコン説明</button></span>--></h3>        
                <div class="">
                    <?php $result = $this->centerClub;
                    if(!empty($result)){
                        foreach ($result as $key=>$center){
                        $str = substr($center->OCBA_CODE,0,1); //Cat ky tu dau cua OCBA_CODE de kiem tra la center hay club
                        if($str == '0'){
                            ?>

                            <div class="cc">
                                <h2>
                                    <span class="id-cc"><?php echo $center->OCBA_CODE; ?></span>
                                    <?php echo $center->OCBA_NAME; ?>
                                    <span class="float-right">
                                        <button href="index.php?top=page&option=com_frcenter&task=detail&id=<?php echo $center->OCBA_CODE; ?>" >詳細情報へ</button> 
                                    </span>
                                </h2>
                                <table cellspacing="0" cellpadding="0" width="700" border="0">
                                    <tbody>
                                        <tr>
                                            <td width="150">〒<?php echo $center->OCBA_POST; ?></td>
                                            <td style="25%" colspan="2"><?php echo $center->OCBA_ADD1.$center->OCBA_ADD2; ?> </td>
                                            <td style="25%">
                                                <?php
                                                    if($center->POOL_POHK == 1) {
                                                        echo '<img src="components/com_frcenter/public/images/pett_hot.gif" class="icon">';
                                                    }
                                                    elseif($center->POOL_POHK == 2) {
                                                        echo '<img src="components/com_frcenter/public/images/pett_heat.gif" class="icon">';
                                                    }
                                                    elseif(isset($center->POOL_OCBA_CODE)){
                                                        echo '<img src="components/com_frcenter/public/images/pool.gif" class="icon"/>';
                                                    }
                                                ?>
                                                <?php
                                                if(isset($center->GYMT_OCBA_CODE)){
                                                    echo '<img src="components/com_frcenter/public/images/pett_phys.gif" class="icon"/>';
                                                }
                                                ?>
                                                <?php
                                                    if($center->DOCK_DOCM_CODE == 2){
                                                        echo '<img src="components/com_frcenter/public/images/pett_mini.gif" class="icon"/>';
                                                    }
                                                    elseif(isset($center->DOCK_OCBA_CODE)){
                                                        echo '<img src="components/com_frcenter/public/images/pett_boat.gif" class="icon"/>';
                                                    }
                                                ?>
                                                <?php
                                                if($center->OCBA_PUTF == 1){
                                                    echo '<img src="components/com_frcenter/public/images/ocba_putf.gif" class="icon"/>';
                                                }
                                                ?>
                                                <?php
                                                if($center->OCBA_LARF == 1){
                                                    echo '<img src="components/com_frcenter/public/images/ocba_larf.gif" class="icon"/>';
                                                }
                                                ?>
                                                <?php
                                                if($center->OCBA_CANF == 1){
                                                    echo '<img src="components/com_frcenter/public/images/ocba_canf.gif" class="icon"/>';
                                                }
                                                ?>
                                                <?php
                                                if($center->OCBA_YACF == 1){
                                                    echo '<img src="components/com_frcenter/public/images/ocba_yacf.gif" class="icon"/>';
                                                }
                                                ?>
                                                <?php
                                                if($center->OCBA_SCHF == 1){
                                                    echo '<img src="components/com_frcenter/public/images/ocba_schf.gif" class="icon"/>';
                                                }
                                                ?>
                                                <?php
                                                if($center->OCBA_OUTF == 1){
                                                    echo '<img src="components/com_frcenter/public/images/ocba_outf.gif" class="icon"/>';
                                                }
                                                ?>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td  style="width: 20%;"></td>
                                            <td  style="width: 25%;">Tel：<?php echo $center->OCBA_TEL; ?></td>
                                            <td  style="width: 25%;">Fax：<?php echo $center->OCBA_FAX; ?></td>
                                            <td  style="width: 30%;"></td>
                                        </tr>
                                    </tbody>
                                </table>
                                <hr/>
                                <table cellspacing="0" cellpadding="0" width="700" border="0">
                                    <tbody>
                                        <tr><strong><?php echo $center->OCBA_LNAME; ?></strong></tr>
                                        <tr>
                                            <td width="150">〒<?php echo $center->OCBA_LPOST; ?> </td>
                                            <td width="340" colspan="3"><?php echo $center->OCBA_LADD1.$center->OCBA_LADD2; ?>  </td>

                                        </tr>
                                        <tr>
                                            <td  style="width: 20%;"></td>
                                            <td  style="width: 25%;">Tel：<?php echo $center->OCBA_LTEL; ?></td>
                                            <td  style="width: 25%;">Fax：<?php echo $center->OCBA_LFAX; ?></td>
                                            <td  style="width: 30%;"></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>

                            <?php }
                            else{
                                ?>


                                <div class="cc">

                                    <h2>
                                        <span class="id-cc"><?php echo $center->OCBA_CODE; ?></span>
                                        <?php echo $center->OCBA_NAME; ?>
                                        <span class="float-right">
                                            <?php if ($center->OCBA_EFLAG == 1)
                                            echo '<label>休部中</label>';
                                            ?>
                                            <button href="index.php?top=page&option=com_frclub&task=detail&id=<?php echo $center->OCBA_CODE; ?>">詳細情報へ</button> 
                                        </span>
                                    </h2>
                                    <table cellspacing="0" cellpadding="0" width="700" border="0">
                                        <tbody>
                                            <tr>
                                                <td class="〒520-1655" style="vertical-align:top" ><?php if($center->OCBA_POST!=null) echo '〒'.$center->OCBA_POST; ?></td>
                                                <td style="width:340px;" colspan="2"><?php echo $center->OCBA_ADD1;echo "<br/>".$center->OCBA_ADD2; ?></td>
                                                <td class="left">【クラブ種別】</td>
                                            </tr>
                                            <tr>
                                                <td style="width: 20%;"></td>
                                                <td style="width: 25%;">Tel:<label><?php echo $center->OCBA_TEL; ?></label></td>
                                                <td style="width: 25%;">Fax：<label><?php echo $center->OCBA_FAX; ?></label></td>
                                                <td><label><?php echo $center->CLUB_NAME; ?></label></td>

                                            </tr>
                                        </tbody>
                                    </table>
                                    <hr/>

                                </div>

                                <?php }
                            }
                        }

                        else{
                            echo "<center>データは見つかりませんでした</center>";
                        }
                        ?>
                    </div>
                </div>
            </div>
            <!-- END CONTENT -->
            <input type="hidden" name="task" value=""/>
            <input type="hidden" name="boxchecked" value="0"/>
        </form>
        <script>
        jq(document).ready(function() {

        // show a dialog box when clicking on a link
        jq('#icon').bind('click', function(e) {
            e.preventDefault();
            jq.Zebra_Dialog('', {
                source:  {'ajax': 'index.php?top=page&option=com_frcenter&task=icon&tmpl=component'},
                height: 500,
                width: 500,
                title:  '【アイコン】ページ',
                type:  '',

            });
        });
    })
</script>     